## Makefile.am -- Process this file with automake to produce Makefile.in

# The script files are listed in two separate variables, SCRIPTFILES1 and SCRIPTFILES2
# because of Sun computers  

SCRIPTFILES1 = 	        										    \
	standard.ys standard.ys.def stdopers.ys yacasinit.ys					    \
	array.rep/code.ys array.rep/code.ys.def 							    \
	assoc.rep/code.ys assoc.rep/code.ys.def 							    \
	c_form.rep/code.ys c_form.rep/code.ys.def 							    \
	complex.rep/code.ys complex.rep/code.ys.def complex.rep/om.ys 					    \
	constants.rep/code.ys constants.rep/code.ys.def  constants.rep/om.ys 				    \
	controlflow.rep/code.ys controlflow.rep/code.ys.def 						    \
	deffunc.rep/code.ys deffunc.rep/code.ys.def 							    \
	deriv.rep/code.ys deriv.rep/code.ys.def 							    \
	example.rep/code.ys example.rep/code.ys.def 							    \
	factors.rep/code.ys factors.rep/code.ys.def 							    \
	factors.rep/binaryfactors.ys factors.rep/binaryfactors.ys.def 					    \
	functional.rep/code.ys functional.rep/code.ys.def functional.rep/om.ys				    \
	graph.rep/code.ys graph.rep/code.ys.def								    \
	html.rep/code.ys html.rep/code.ys.def 								    \
	integrate.rep/code.ys integrate.rep/code.ys.def integrate.rep/om.ys   \
	io.rep/code.ys io.rep/code.ys.def io.rep/print.ys io.rep/formula.ys io.rep/errors.ys 		    \
	io.rep/defaultprint.ys io.rep/defaultprint.ys.def 						    \
	limit.rep/code.ys limit.rep/code.ys.def limit.rep/om.ys						    \
	linalg.rep/code.ys linalg.rep/code.ys.def 							    \
	lists.rep/code.ys lists.rep/code.ys.def 							    \
	lists.rep/scopestack.ys lists.rep/scopestack.ys.def 						    \
	localrules.rep/code.ys localrules.rep/code.ys.def 						    \
	logic.rep/code.ys logic.rep/code.ys.def logic.rep/om.ys 					    \
	multivar.rep/code.ys multivar.rep/code.ys.def multivar.rep/makemulti.ys  			    \
	multivar.rep/sparsetree.ys multivar.rep/sparsetree.ys.def multivar.rep/sparsenomial.ys	 	    \
	newly.rep/code.ys newly.rep/code.ys.def 							    \
	numbers.rep/code.ys numbers.rep/code.ys.def numbers.rep/om.ys					    \
	numbers.rep/nthroot.ys numbers.rep/nthroot.ys.def                                                   \
	odesolver.rep/code.ys odesolver.rep/code.ys.def 						    \
	openmath.rep/code.ys openmath.rep/code.ys.def 							    \
	orthopoly.rep/code.ys orthopoly.rep/code.ys.def 						    \
	padic.rep/code.ys padic.rep/code.ys.def 							    \
	patterns.rep/code.ys patterns.rep/code.ys.def 							    \
	plots.rep/code.ys plots.rep/code.ys.def plots.rep/backends-2d.ys plots.rep/backends-3d.ys           \
        plots.rep/plot2d.ys.def plots.rep/plot3d.ys.def plots.rep/plot2d.ys plots.rep/plot3d.ys             \
	predicates.rep/code.ys predicates.rep/code.ys.def 						    \
	pslq.rep/code.ys pslq.rep/code.ys.def 								    \
	rabinmiller.rep/code.ys rabinmiller.rep/code.ys.def 						    \
	radsimp.rep/code.ys radsimp.rep/code.ys.def 							    \
	random.rep/code.ys random.rep/code.ys.def 							    \
	simplify.rep/code.ys simplify.rep/code.ys.def simplify.rep/factorial.ys simplify.rep/factorial.ys.def 							    \
	solve.rep/code.ys solve.rep/code.ys.def                                                		    \
	debug.rep/code.ys debug.rep/code.ys.def			  					    \
	specfunc.rep/bessel.ys specfunc.rep/bessel.ys.def specfunc.rep/bernou.ys specfunc.rep/bernou.ys.def \
	specfunc.rep/code.ys specfunc.rep/code.ys.def specfunc.rep/gammaconst.ys specfunc.rep/gammaconst.ys.def \
	specfunc.rep/gamma.ys specfunc.rep/gamma.ys.def specfunc.rep/zeta.ys specfunc.rep/zeta.ys.def specfunc.rep/om.ys  \
	statistics.rep/hypothesystest.ys statistics.rep/incompletegamma.ys.def	 			    \
	statistics.rep/regression.ys.def statistics.rep/hypothesystest.ys.def 				    \
	statistics.rep/randomtest.ys statistics.rep/statistics.ys 					    \
	statistics.rep/incompletegamma.ys statistics.rep/regression.ys	 				    \
	statistics.rep/statistics.ys.def 								    \
	statistics.rep/distributions.ys statistics.rep/distributions.ys.def 




#        test.ys    test.ys.def


SCRIPTFILES2 = \
	stats.rep/code.ys stats.rep/code.ys.def 							    \
	stdfuncs.rep/code.ys stdfuncs.rep/code.ys.def stdfuncs.rep/om.ys stdfuncs.rep/numerical.ys 	    \
	stdfuncs.rep/numerical.ys.def stdfuncs.rep/nummethods.ys stdfuncs.rep/nummethods.ys.def 	    \
	stubs.rep/code.ys stubs.rep/code.ys.def stubs.rep/om.ys stdfuncs.rep/elemfuncs.ys                   \
	substitute.rep/code.ys substitute.rep/code.ys.def stdfuncs.rep/elemfuncs.ys.def 		    \
	sums.rep/code.ys sums.rep/code.ys.def sums.rep/taylor.ys sums.rep/taylor.ys.def   sums.rep/taylor3.ys sums.rep/taylor3.ys.def   sums.rep/om.ys  \
	tensor.rep/code.ys tensor.rep/code.ys.def 							    \
	testers.rep/code.ys testers.rep/code.ys.def 							    \
	texform.rep/code.ys texform.rep/code.ys.def 							    \
	trigsimp.rep/code.ys trigsimp.rep/code.ys.def 							    \
	univar.rep/code.ys univar.rep/code.ys.def univar.rep/sturm.ys univar.rep/sturm.ys.def               \
	univar.rep/Cyclotomic.ys  univar.rep/Cyclotomic.ys.def 						    \
	univar.rep/sparse.ys  univar.rep/sparse.ys.def 	                                                    \
        probability.rep/code.ys  probability.rep/code.ys.def                                                \
	numbers.rep/NumberTheory.ys numbers.rep/NumberTheory.ys.def                                         \
	numbers.rep/GaussianIntegers.ys numbers.rep/GaussianIntegers.ys.def				    \
	transforms.rep/code.ys transforms.rep/code.ys.def \
  base.rep/math.ys base.rep/math.ys.def \
	stdarith.ys stdarith.ys.def calendar.rep/code.ys calendar.rep/code.ys.def

EXAMPLE_SCRIPTFILES = \
	examples/ABIN.ys examples/pi.ys \
	examples/findsum.ys examples/wordproblems.ys \
	examples/queens.ys examples/benchmark.ys examples/MinimumSpanningTree.ys \
	examples/benchmark2.ys examples/benchbuild.ys  examples/goldbach.ys examples/series.ys

GENERATED_SCRIPTFILES = \
	packages.ys corefunctions.ys

#CLEANFILES = $(GENERATED_SCRIPTFILES)
#noinst_SCRIPTS = $(GENERATED_SCRIPTFILES)

# All the above script files need to be installed in $(scriptdir).
# Furthermore, we do not want to strip the directory: "univar.rep/code.ys"
# needs to be installed as "$(scriptdir)/univar.rep/code.ys", and not as
# "$(scriptdir)/code.ys". Automake 1.5 has a nice nobase_ prefix to achieve
# this, but we want to be compatible with version 1.4. So we copied the
# following code from the code generated by Automake 1.5.

ALLSCRIPTS = $(SCRIPTFILES1) $(SCRIPTFILES2) $(EXAMPLE_SCRIPTFILES) $(GENERATED_SCRIPTFILES)

install-data-local: $(ALLSCRIPTS)
	@$(NORMAL_INSTALL)
	$(mkinstalldirs) $(DESTDIR)$(scriptdir)
	@list='$(ALLSCRIPTS)'; for p in $$list; do \
	  dir=`echo "$$p" | sed -e 's,/[^/]*$$,,'`; \
	  if test "$$dir" != "$$p" && test "$$dir" != "."; then \
	    $(mkinstalldirs) "$(DESTDIR)$(scriptdir)/$$dir"; \
	  fi; \
	  f="`echo $$p|sed '$(transform)'`"; \
	  if test -f $$p; then \
	    echo " $(INSTALL_DATA) $$p $(DESTDIR)$(scriptdir)/$$f"; \
	    $(INSTALL_DATA) $$p $(DESTDIR)$(scriptdir)/$$f; \
	  elif test -f $(srcdir)/$$p; then \
	    echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(scriptdir)/$$f"; \
	    $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(scriptdir)/$$f; \
	  else :; fi; \
	done

uninstall-local:
	@$(NORMAL_UNINSTALL)
	@list='$(ALLSCRIPTS)'; for p in $$list; do \
	  f="`echo $$p|sed '$(transform)'`"; \
	  echo " rm -f $(DESTDIR)$(scriptdir)/$$f"; \
	  rm -f $(DESTDIR)$(scriptdir)/$$f; \
	done

## Scripts are not automatically distributed, so force this

EXTRA_DIST = $(ALLSCRIPTS) maketest 

# Automatically generate a full list of all .def files

all-local: $(srcdir)/packages.ys $(srcdir)/corefunctions.ys

$(srcdir)/packages.ys: $(srcdir)/Makefile.am
	@echo "Creating list of packages in $@...";                  
	@echo "/// This file is generated by a script."        > $@ 
	@echo "/// It lists all {.def} files in the library."  >> $@
	@echo "Defun(DefFileList,{}) {"                             >> $@
	@echo $(SCRIPTFILES1) $(SCRIPTFILES2)               \
           | tr -s '[ \t]' '[\n*]' | grep '\.def$$' | sort  \
	   | uniq | sed 's/^/"/;s/$$/",/;s/\.def//'	       >> $@
	@echo "};"                                            >> $@

$(srcdir)/corefunctions.ys: $(top_srcdir)/src/corefunctions.h $(top_srcdir)/src/yacasmain.cpp
	(cd ../src && make gencorefunctions$(EXEEXT))
	../src/gencorefunctions$(EXEEXT) > $(srcdir)/corefunctions.ys



check:
	@(for i in $(ALLSCRIPTS); do echo $$i; done) | sort > scripts-listed-in-makefile.txt
	@find $(srcdir)/../scripts \( -name \*.ys -o -name \*.ys.def \) -print \
	   | sed -e 's,.*scripts/,,' | sort > contents-of-tree.txt
	@echo "Comparing scripts listed in the Makefile against the contents of the tree"
	@(diff scripts-listed-in-makefile.txt contents-of-tree.txt; \
	  rm -f scripts-listed-in-makefile.txt contents-of-tree.txt; \
	  RV=$$?; \
	  if [[ $$RV == 0 ]] ; \
	      then echo " ... ok"; \
	  else \
	      false; \
	  fi \
	)
